# _*_ coding : utf-8 _*_
# @Time : 2023/12/12 9:40
# @Author : 韩宗森
# @File : 27_requests_基本使用
# @Project : pythonProject

import requests

# url = 'https://www.baidu.com'
url = 'https://hotels.ctrip.com/hotels/detail/?hotelId=108797486&checkIn=2023-12-12&checkOut=2023-12-13&cityId=380&minprice=&mincurr=&adult=1&children=0&ages=&crn=1&curr=&fgt=&stand=&stdcode=&hpaopts=&mproom=&ouid=&shoppingid=&roomkey=&highprice=-1&lowprice=0&showtotalamt=&hotelUniqueKey='

response = requests.get(url=url)

# 一个类型和六个厨性
# print(type(response))

response.encoding = 'utf-8'

# 以字符串的形式来返回了网页的源码
# print(response.text)

# 返回一个url地址
# print(response.url)

# 返回的是二进制的数据
# print(response.content)

# 返回响应的状态码
# print(response.status_code)

# 返回的是响应头
# print(response.headers)

# 数据下载到本地
with open('测试.html', 'w', encoding='utf-8') as fp:
    fp.write(response.text)
